{include file="public/layout" /}
<script src="__SKIN__/js/users_upgrade.js?v={$version}"></script>
<script type="text/javascript" src="__PUBLIC__/plugins/colpick/js/colpick.js"></script>
<link href="__PUBLIC__/plugins/colpick/css/colpick.css" rel="stylesheet" type="text/css"/>
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<style type="text/css">
#picker {
    /*margin:0;*/
    /*padding:0;*/
    border:solid 1px #ccc;
    width:70px;
    height:20px;
    border-right:40px solid green;
    /*line-height:20px;*/
}
</style>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    {include file="member/bar" /}
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                <h3>功能配置</h3>
                <h5></h5>
            </div>
            <form class="navbar-form form-inline" action="{:url('Member/level_index')}" method="get" onsubmit="layer_loading('正在处理');">
                {$searchform.hidden|default=''}
                <div class="sDiv">
                    {include file="member/users_bar" /}
                </div>
            </form>
        </div>
        <form class="form-horizontal" id="postForm" action="{:url('Member/users_config')}" method="post">
<!--             <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                        <tr>
                            <th class="sign w10" axis="col0">
                                <div class="tc"></div>
                            </th>
                            <th abbr="article_title" axis="col3" class="w10">
                                <div class="tc">登录设置</div>
                            </th>
                            <th abbr="ac_id" axis="col4">
                                <div class=""></div>
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit">
                        <label for="uname">第三方登录</label>
                    </dt>
                    <dd class="opt">
                        <label>
                            <input type="radio" name="oauth[oauth_open]" value="1" {if condition="$info.oauth_open == 1"}checked="checked"{/if}/>开启
                        </label>
                        &nbsp;&nbsp;&nbsp;
                        <label>
                            <input type="radio" name="oauth[oauth_open]" value="0" {if condition="!isset($info.oauth_open) || empty($info.oauth_open)"}checked="checked"{/if}/>关闭
                        </label>
                        <span style="padding-left: 10px; color: #C0C0C0;">关闭则自动隐藏第三方登录入口。</span>
                    </dd>
                </dl>
                <dl class="row {if condition="!isset($info.oauth_open) || empty($info.oauth_open)"}none{/if}" id="oauth_list">
                    <dt class="tit">
                        <label for="uname">第三方平台</label>
                    </dt>
                    <dd class="opt" style="line-height: 30px;">
                        <label>
                            <input type="checkbox" name="oauth[oauth_qq]" value="1" {if condition="!isset($info.oauth_qq) || $info.oauth_qq == 1"}checked="checked"{/if} />Q&nbsp;Q登录
                        </label>
                        <span style="padding-left: 23px; color: #C0C0C0;"><a href="javascript:void(0);" onclick="set_oauth_config(this);" data-oauth="qq" data-title="QQ登录配置">[配置参数]</a></span>
                        <br/>
                        <label>
                            <input type="checkbox" name="oauth[oauth_weixin]" value="1" {if condition="!isset($info.oauth_weixin) || $info.oauth_weixin == 1"}checked="checked"{/if} />微信登录
                        </label>
                        <span style="padding-left: 23px; color: #C0C0C0;"><a href="javascript:void(0);" onclick="set_oauth_config(this);" data-oauth="weixin" data-title="微信登录配置">[配置参数]</a></span>
                        <br/>
                        <label>
                            <input type="checkbox" name="oauth[oauth_weibo]" value="1" {if condition="!isset($info.oauth_weibo) || $info.oauth_weibo == 1"}checked="checked"{/if} />微博登录
                        </label>
                        <span style="padding-left: 23px; color: #C0C0C0;"><a href="javascript:void(0);" onclick="set_oauth_config(this);" data-oauth="weibo" data-title="微博登录配置">[配置参数]</a></span>
                    </dd>
                </dl>
            </div> -->

<!--             <div class="hDiv">
    <div class="hDivBox">
        <table cellspacing="0" cellpadding="0" style="width: 100%">
            <thead>
            <tr>
                <th class="sign w10" axis="col0">
                    <div class="tc"></div>
                </th>
                <th abbr="article_title" axis="col3" class="w10">
                    <div class="tc">会员系统</div>
                </th>
                <th abbr="ac_id" axis="col4">
                    <div class=""></div>
                </th>
            </tr>
            </thead>
        </table>
    </div>
</div>

<div class="ncap-form-default">
    <dl class="row">
        <dt class="tit">
            <label for="uname">前台模板更新</label>
        </dt>
        <dd class="opt">
            <label id="td_upgrade_msg">
                <div id="upgrade_filelist" style="display:none;"></div> 
                <div id="upgrade_intro" style="display:none;"></div> 
                <div id="upgrade_notice" style="display:none;"></div> 
                <a href="javascript:void(0);" id="a_upgrade" data-version="" data-max_version="" data-iframe="workspace" title="" data-upgrade_url="{:url('Member/OneKeyUpgrade')}" data-check_authority="{:url('Member/check_authority')}">正在版本检测中……</a>
            </label>
        </dd>
    </dl>
</div> -->

            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                        <tr>
                            <th class="sign w10" axis="col0">
                                <div class="tc"></div>
                            </th>
                            <th abbr="article_title" axis="col3" class="w10">
                                <div class="tc">注册设置</div>
                            </th>
                            <th abbr="ac_id" axis="col4">
                                <div class=""></div>
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>

            <!-- config/users -->
            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit">
                        <label for="uname">会员中心</label>
                    </dt>
                    <dd class="opt">
                        <label>
                            <input type="radio" name="users[users_open_register]" value="0" {if condition="!isset($info.users_open_register) || empty($info.users_open_register)"}checked="checked"{/if}/>开启
                        </label>
                        &nbsp;&nbsp;&nbsp;
                        <label>
                            <input type="radio" name="users[users_open_register]" value="1" {if condition="$info.users_open_register == 1"}checked="checked"{/if}/>关闭
                        </label>
                        <span style="padding-left: 10px; color: #C0C0C0;">关闭则自动隐藏账户注册/登录的入口。</span>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit">
                        <label for="username">注册验证</label>
                    </dt>
                    <dd class="opt" style="line-height: 30px;">
                        <label>
                            <input type="radio" name="users[users_verification]" value="0" {if condition="!isset($info.users_verification) || empty($info.users_verification)"}checked="checked"{/if}/>不验证
                            <span style="padding-left: 23px; color: #C0C0C0;">注册会员后，可直接登录，无需验证。</span>
                        </label>
                        <br/>
                        <label>
                            <input type="radio" name="users[users_verification]" value="1" {if condition="$info.users_verification == 1"}checked="checked"{/if}/>后台激活
                            <span style="padding-left: 10px; color: #C0C0C0;">注册会员后，需后台审核激活后才能登录。</span>
                        </label>
                        <br/>
                        <label>
                            <input type="radio" name="users[users_verification]" value="2" onclick="email();" {if condition="$info.users_verification == 2"}checked="checked"{/if}/>邮件验证
                            <span style="padding-left: 10px; color: #C0C0C0;" >注册会员中，发送邮箱验证码校验才能注册。</span>
                        </label>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit">
                        <label for="username">禁止注册用户名</label>
                    </dt>
                    <dd class="opt" style="line-height: 30px;">
                        <textarea rows="5" cols="60" name="users[users_reg_notallow]" style="height:60px;">{$info.users_reg_notallow|default='www,bbs,ftp,mail,user,users,admin,administrator,eyoucms'}</textarea>
                        <p class="notic">前台注册时禁止注册的用户名列表，以逗号(,)分隔开</p>
                    </dd>
                </dl>
            </div>
            <!-- config/theme -->
            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0" style="width: 100%">
                        <thead>
                        <tr>
                            <th class="sign w10" axis="col0">
                                <div class="tc"></div>
                            </th>
                            <th abbr="article_title" axis="col3" class="w10">
                                <div class="tc">前台风格设置</div>
                            </th>
                            <th abbr="ac_id" axis="col4">
                                <div class=""></div>
                            </th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit">
                        <label for="uname">左侧菜单</label>
                    </dt>
                    <dd class="opt">
                        <a href="javascript:void(0);" onclick="menu_index();" class="ncap-btn ncap-btn-green">管理</a>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit">
                        <label for="uname">主题颜色</label>
                    </dt>
                    <dd class="opt">
                        <input type="text" name="theme[theme_color]" value="{$info.theme_color|default='#ff6565'}" id="picker" style="border-color: {$info.theme_color|default='#ff6565'};" />
                    </dd>
                </dl>
            </div>

            <div class="ncap-form-default">
                <dl class="row">
                    <div class="bot">
                        <a href="JavaScript:void(0);" onclick="usersset();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
                    </div>
                </dl>
            </div>

        </form>
    </div>
</div>
<script>
    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });

        $('input[name="oauth[oauth_open]"]').click(function(){
            var oauth_open = $(this).val();
            if (1 == oauth_open) {
                $('#oauth_list').show();
            } else {
                $('#oauth_list').hide();
            }
        });

        // 颜色选择
        $('#picker').colpick({
            flat:false,
            layout:'rgbhex',
            submit:0,
            colorScheme:'light',
            color:$('#picker').val(),
            onChange:function(hsb,hex,rgb,el,bySetColor) {
                $(el).css('border-color','#'+hex);
                // Fill the text box just if the color was set using the picker, and not the colpickSetColor function.
                if(!bySetColor) $(el).val('#'+hex);
            }
        }).keyup(function(){
            $(this).colpickSetColor('#'+this.value);
        });

        // 版本检测更新弹窗
        // $.ajax({
        //     type : "GET",
        //     url  : "{:url('Member/ajax_check_upgrade_version')}",
        //     data : {_ajax:1},
        //     dataType : "JSON",
        //     success: function(res) {
        //         if (1 == res.code) {
        //             if (2 == res.data.code) {
        //                 $('#upgrade_filelist').html(res.data.msg.upgrade);
        //                 $('#upgrade_intro').html(res.data.msg.intro);
        //                 $('#upgrade_notice').html(res.data.msg.notice);
        //                 $('#a_upgrade').attr('data-version', res.data.msg.key_num)
        //                 .attr('data-max_version', res.data.msg.max_version)
        //                 .attr('title', res.data.msg.tips);
        //                 $('#a_upgrade').html('检测到新版本'+res.data.msg.key_num+'[点击查看]').css('color', '#F00');

        //                 {if condition="(0 >= $Think.session.admin_info.role_id OR 1 == $Think.session.admin_info.auth_role_info.online_update)"}
        //                     // btn_upgrade($("#a_upgrade"), 0);
        //                 {/if}
        //             } else {
        //                 $('#td_upgrade_msg').html(res.data.msg);
        //             }
        //         }
        //     }
        // });
    });

    function email(){
        $.ajax({
            url: "{:url('Member/ajax_users_config_email')}",
            type: 'GET',
            dataType: 'JSON',
            data: {_ajax:1},
            success: function(res){
                if (res.code == 0) {
                    $("input[name='users[users_verification]'][value=0]").attr("checked","checked" );
                    layer.alert(res.msg, {icon: 2, title:false});
                    return false;
                }
            },
            error: function(e){
                showErrorMsg(ey_unknown_error);
                return false;
            }
        });
    }

    function set_oauth_config(obj)
    {
        var title = $(obj).data('title');
        var oauth = $(obj).data('oauth');
        var url = "{:url('Member/ajax_set_oauth_config')}";
        if (url.indexOf('?') > -1) {
            url += '&';
        } else {
            url += '?';
        }
        url += 'oauth='+oauth;
        //iframe窗
        layer.open({
            type: 2,
            title: title,
            fixed: true, //不固定
            shadeClose: false,
            shade: 0.3,
            maxmin: true, //开启最大化最小化按钮
            area: ['80%', '80%'],
            content: url
        });
    }

    function menu_index()
    {
        var url = "{:url('Member/ajax_menu_index')}";
        //iframe窗
        layer.open({
            type: 2,
            title: '前台会员中心左侧菜单',
            fixed: true, //不固定
            shadeClose: false,
            shade: 0.3,
            maxmin: true, //开启最大化最小化按钮
            area: ['80%', '80%'],
            content: url
        });
    }

    function usersset(){
        layer_loading('正在处理');
        $('#postForm').submit();
    }

</script>

{include file="public/footer" /}